package com.practice.system.service.impl;

import com.practice.system.mapper.MaterielMapper;
import com.practice.system.pojo.Materiel;
import com.practice.system.service.MaterielService;
import com.practice.utils.PageUtils;
import com.practice.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.UUID;

@Service
public class MaterielServiceImpl implements MaterielService {
    @Autowired
    MaterielMapper materielMapper;
    @Override
    public Boolean addValue(Map<String, Object> params) {
        params.put("id", UUID.randomUUID().toString());
        materielMapper.addValue(params);
        return true;
    }

    @Override
    public R queryPage(Map<String,Object> params) {
        List<Materiel> materielList =  materielMapper.queryPage(params);
        PageUtils pageUtils = new PageUtils(materielList,materielList.size());
        return R.ok().put("page",pageUtils);
    }
}
